package com.code9xs.mapper;

import com.code9xs.pojo.Announcement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface AnnouncementMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Announcement record);

    int insertSelective(Announcement record);

    Announcement selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Announcement record);

    int updateByPrimaryKeyWithBLOBs(Announcement record);

    int updateByPrimaryKey(Announcement record);

    /**
     * 查询社团所有有效公告
     * @param aid
     * @return
     */
    List<Announcement> selectAssociationAnnounceByAid(@Param("aid")Integer aid);

    /**
     * 查询社团公告数量
     * @param aid
     * @return
     */
    int selectCountByAid(@Param("aid") Integer aid);

    List<Map<String,Object>> selectAssociationAnnouncementPaginationByAid(@Param("aid")Integer aid, @Param("start")Integer start, @Param("pageSize")Integer pageSize);
}